package networking;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server1 {
	public static void main(String[] args) throws IOException {
		ServerSocket ss = new ServerSocket(100);
		System.out.println("Server socket created with port "
				+ ss.getLocalPort());
		Socket s = ss.accept();

		System.out.println("connection success");
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		System.out.println("Enter the txt: ");
		OutputStream out = s.getOutputStream();

		while (true) {
			int ch;
			while ((ch = br.read()) != '\n')
				out.write(ch);
			out.write('\n');
		}

	}
}